﻿using UnityEngine;

namespace Core
{
    public class EnemyMoveState : BaseState
    {
        private int move = Animator.StringToHash("move");
        private Unit unit;
        public EnemyMoveState(Unit unit)
        {
            this.unit = unit;
        }

        public override void Enter()
        {
            unit.Animator.SetBool(move, true);  
            unit.AddComponent<EnemyFollow, Unit>(Player.Instance.GetParent<Unit>());

        }
        public override void Exit()
        {
            unit.Animator.SetBool(move, false);
            unit.RemoveComponent<EnemyFollow>();
        }
    }
}